package com.elm.cart.mapper;

import com.elm.cart.pojo.Cart;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CartMapper {

    List<Cart> listCart(String userId, Integer businessId);

    @Insert("insert into cart(foodId,businessId,userId,quantity) values (#{foodId},#{businessId},#{userId},#{quantity})")
    Integer saveCart(Cart cart);

    @Update("update cart set quantity=#{quantity} where foodId=#{foodId} and businessId=#{businessId} and userId=#{userId} ")
    Integer update(Cart cart);

    Integer removeCart(String userId, Integer businessId, Integer foodId);
}
